package com.vca.front.controller;

import com.alibaba.fastjson.JSON;
import com.vca.common.page.CommonPage;
import com.vca.common.request.PageParamRequest;
import com.vca.common.request.TalkSearchRequest;
import com.vca.common.response.TalkResponse;
import com.vca.common.result.CommonResult;
import com.vca.service.service.TalkService;
import com.vca.service.service.VhallService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 讲座控制器
 *
 * @author chenbing
 * @date 2022/11/3   14:12
 */
@Slf4j
@RestController("TalkController")
@RequestMapping("api/front/talk")
@Api(tags = "讲座控制器")
public class TalkController {
    @Autowired
    private TalkService talkService;

    @Autowired
    private VhallService vhallService;

    /**
     * @Description:讲座分页列表
     * @Author: chenBing
     * @Date: 2022/11/3
     */
    @ApiOperation(value = "讲座分页列表")
    @GetMapping(value = "/list")
    public CommonResult<CommonPage<TalkResponse>> list(
            @RequestHeader(value = "language",required = false) String language,
            @Validated PageParamRequest pageParamRequest
    ) {
        return CommonResult.success(CommonPage.restPage(talkService.getList(language,pageParamRequest)));
    }

    /**
     * @Description:讲座详情
     * @Author: chenBing
     * @Date: 2022/11/3
     */
    @ApiOperation(value = "讲座详情")
    @GetMapping(value = "/info")
    public CommonResult<TalkResponse> info(
            @RequestHeader(value = "language",required = false) String language,
            @RequestParam(value = "talkId") Long talkId
    ) {
        return CommonResult.success(talkService.info(language,talkId));
    }

}
